package com.diary.server.config;

import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.OpenAPI;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springdoc.core.models.GroupedOpenApi;

public class SwaggerConfig {
    //设置doc.html首先
    @Bean
    public OpenAPI openAPI() {
        Contact contact = new Contact();
        contact.setName("名字");
        return new OpenAPI()
                .info(new Info()
                        .title("hello-knife4j项目API")
                        .contact(contact)
                        .version("1.0")
                        .description("hello-knife4j项目的接口文档"));
    }

    //指定接口文档的分组
    @Bean
    public GroupedOpenApi userAPI(){
        return GroupedOpenApi.builder()
                .group("user")
                .displayName("用户接口")
                .pathsToMatch("/controller/**").build();
    }

//    @Bean
//    public GroupedOpenApi loginAPI(){
//        return GroupedOpenApi.builder()
//                .group("login")
//                .displayName("登录接口")
//                .pathsToMatch("/login/**").build();
//    }

}
